package com.set.mobileapp.adapter;

import java.util.List;

import com.set.mobileapp.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

public class TodoItemsAdapter extends BaseAdapter {

	private List menuList;
	private Context ctx;

	public TodoItemsAdapter(List m, Context context) {
		this.menuList = m;
		this.ctx = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return menuList.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		arg1 = new LinearLayout(this.ctx);
		LinearLayout layout = (LinearLayout)arg1;
		TextView tv = new TextView(this.ctx);
		tv.setText((String) this.menuList.get(arg0));
		tv.setBackgroundResource(R.layout.bg_card);
		LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
				LinearLayout.LayoutParams.MATCH_PARENT,
				LinearLayout.LayoutParams.WRAP_CONTENT);
		lp.leftMargin = 10;
		lp.rightMargin = 10;
		lp.topMargin = 10;
		lp.bottomMargin = 10;
		layout.addView(tv, lp);
		return arg1;
	}
}
